package com.hqyj.freemovie.front.repository;

import com.hqyj.freemovie.front.view.MovieView;
import com.hqyj.freemovie.front.view.Students;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface MovieViewRepository extends ElasticsearchRepository<MovieView,String> {

    //根据电影的名字，类型，介绍，导演进行全文检索。
    @Query("{ \"bool\":{ \"must\":[ { \"multi_match\": { \"query\": \"?0\", \"type\": \"most_fields\", \"fields\": [ \"name\", \"introduce\",\"director\",\"type\" ] } } ] } } ")
    Page<MovieView> elasticsearchMoviesByKeyWords(String keyword, Pageable pageable);
}
